import { createRouter, createWebHashHistory } from 'vue-router'
import PersonalCenter from '../home/PersonalCenter'

const routes = [
  {
    path: '/personal-center',
    name: 'PersonalCenter',
    component: PersonalCenter,
    children: [
      // 将原有路由作为子路由
      { path: '/preorder',  name: 'PreOrder',  component: () => import('../order/PreOrder')},
      { path: '/pre-order-details', name: 'PreOrderDetails', component: () => import('../order/PreOrderDetails'), props: true },
      { path: '/create-order', name: 'CreateOrder', component: () => import('../order/CreateOrder'), props: true },
      { path: '/order-details',  name: 'OrderDetails',  component: () => import('../order/OrderDetails'),  props: true,},
      { path: '/paypal-payment',  name: 'PayPalPayment',  component: () => import('../pay/PaypalPayment'),  props: true,},
      { path: '/payment-status',  name: 'PaymentStatus',  component: () => import('../pay/PaymentStatus'),  props: true,},
      { path: '/order-list',  name: 'OrderList',  component: () => import('../order/OrderList'),  props: true,}
    ]
  },
  { path: '/login',  name: 'UserLogin',  component: () => import('../login/UserLogin')},
  { path: '/about',  name: 'About',  component: () => import('../views/AboutView')},
  { path: '/cancel',  name: 'Cancel',  component: () => import('../views/CancelView')},
  { path: '/admin',  name: 'Amin',  component: () => import('../admin/AdminDashboard')},
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
